﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Configuration;


namespace Html5Music.Data
{
    public class Config
    {
        static Config()
        {
            Key_PlayList = WebConfigurationManager.AppSettings["Key_PlayList"];
            Key_UserList = WebConfigurationManager.AppSettings["Key_UserList"];
        }


        private static string _path_playlist;

        public static string Path_PlayList
        {
            get { return _path_playlist; }
            set
            {
                InitData(ref _path_playlist, value);
            }
        }

        private static string _path_userlist;

        public static string Path_UserList
        {
            get { return _path_userlist; }
            set
            {
                InitData(ref _path_userlist, value);
            }
        }


        private static string _key_playlist = "Music.Key.PlayList";

        public static string Key_PlayList
        {
            get { return _key_playlist; }
            set
            {
                InitConfigData(ref _key_playlist, value);
            }
        }

        private static string _key_userlist = "Music.Key.UserList";

        public static string Key_UserList
        {
            get { return _key_userlist; }
            set
            {
                InitConfigData(ref _key_userlist, value);
            }
        }



        private static void InitData(ref string set, string val)
        {
            if (string.IsNullOrWhiteSpace(set))
            {
                set = val;
            }
        }
        private static void InitConfigData(ref string set, string val)
        {
            if (!string.IsNullOrWhiteSpace(val))
            {
                set = val;
            }
        }
    }
}
